<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="12" >
            <a-form-item>
              <j-input :placeholder="$t('base.inputVagueQuery')"  v-model="queryParam.gatewayName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="12" >
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button  type="primary" @click="searchQuery" icon="search"> {{$t('base.query')}} </a-button>
              <a-button  type="primary"  @click="searchReset" icon="reload" style="margin-left: 2px"> {{$t('base.reset')}} </a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">

    </div>

    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{fixed:false,type:'radio',selectedRowKeys: selectedRowKeys, onClickRow: onSelectChangeData}"
        :customRow="onClickRow"
        @change="handleTableChange">
        <template slot="nameslot" slot-scope="text, record, index">
          <div class="anty-img-wrap">
            <j-ellipsis :length="10" :value="record.gatewayName"/>
          </div>
        </template>
      </a-table>
    </div>

  </a-card>
</template>

<script>

    import {JeecgListMixin} from '@/mixins/JeecgListMixin'
    import GlrGatewayModal from './modules/GlrGatewayModal'
    import GlrGatewayView from './modules/GlrGatewayView'
    import {httpAction} from '@/api/manage'
    import JInput from '@/components/jeecg/JInput'
    import GlrPatternGatewayList from "./GlrPatternGatewayList";
    import GlrLightLG from "./modules/GlrLightLG";
    import GlrLightGateWayAddress from "./GlrLightGateWayAddress";
    import GlrLightGateWayRatedPower from "./GlrLightGateWayRatedPower";

    import JEllipsis from "@/components/jeecg/JEllipsis"
    export default {
        name: "GlrSideGateWayList",
        mixins: [JeecgListMixin],
        props: ['gateWayCode'],
        components: {
            GlrLightGateWayAddress,
            GlrLightGateWayRatedPower,
            GlrLightLG,
            GlrPatternGatewayList,
            GlrGatewayModal,
            GlrGatewayView,
            JInput,
            JEllipsis
        },
        data() {
            return {
                description: '网关管理管理页面',
                 smallsize:"small",
                spinning: false,
                projectList:[],

                description: '路灯亮度设置页面',
                brightnessSetTitle:'亮度设置',
                brightnessSetVisible:false,
                brightnessSetConfirmLoading:false,
                disabledValue:false,
                brightnessValue:0,
                maxValue:100,
                // 表头
                columns: [
                    {
                        title: this.$t('light.serialNumber') ,
                        dataIndex: '',
                        width: 50,
                        align: "center",
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: this.$t('light.gateWayName') ,
                        align: "center",
                        dataIndex: 'gatewayName',
                        scopedSlots: {customRender: "nameslot"}
                    },

                ],
                url: {
                    list: "/glr/glrGateway/list",

                },
                dictOptions: {},
            }
        },
        created(){

        },
        computed: {
        },
        methods: {

            onClickRow(record) {
                return {
                    on: {
                        click: () => {
                            let keys = [];
                            keys.push(record.id);
                            this.selectedRowKeys = keys;
                            var gateWayCode=record.gateWayCode;
                            this.$emit('getGateWayCode', gateWayCode);
                        }
                    }
                }
            },
            onSelectChangeData(selectedRowKeys, selectionRows) {
                this.selectedRowKeys = selectedRowKeys;
                this.selectionRows = selectionRows;
                var gateWayCode=this.selectionRows[0].gateWayCode;
                this.$emit('input', gateWayCode);
            }
        }
    }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>